You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hatch environments contain a pyvenv.cfg, so PET previously classified them as plain Venv. Downstream consumers (e.g. vscode-python-environments) then routed them into the wrong manager collection.
Changes
New pet-hatch crate implementing the Locator trait, modeled on pet-uv / pet-virtualenvwrapper.
Resolves Hatch's virtual storage dir from HATCH_DATA_DIR, then platform defaults matching platformdirs.user_data_dir("hatch", appauthor=False) + env/virtual (Linux: $XDG_DATA_HOME/hatch/... or ~/.local/share/hatch/...; macOS: ~/Library/Application Support/hatch/...; Windows: %LOCALAPPDATA%\hatch\...).
try_from() claims a prefix as Hatch when it is either:
Two components deep under the virtual storage dir (<storage>/<project-hash>/<env-name>), or
Inside a project-local .hatch/<env-name>/ whose grandparent contains a hatch.toml or a [tool.hatch] / [tool.hatch.*] section in pyproject.toml.
Uses the pyvenv.cfgprompt for name; sets project_path for the project-local case.
find() walks the default storage dir and the configured workspace .hatch/ dirs.
Core enums: add Hatch to PythonEnvironmentKind and LocatorKind.
Locator chain (crates/pet/src/locators.rs): insert Hatch immediately before Venv so it claims first.
Refresh-contract test (crates/pet/src/jsonrpc.rs): register LocatorKind::Hatch as RefreshStatePersistence::ConfiguredOnly.
Notes for reviewers
For envs in the default storage layout, the project path cannot be reliably reverse-engineered from the <project-name>-<hash> directory name, so project_path is left None there. It is populated for the project-local .hatch/ case.
Project-local .hatch/ discovery requires a Hatch marker file in the workspace to avoid false positives on unrelated .hatch directories.
Identification of the default-storage layout is purely path-shape based (no marker required), matching how pet-uv and pet-poetry claim envs in their managed directories.
CopilotAI
changed the title
[WIP] Add Hatch environment detection with new pet-hatch locator
Add pet-hatch locator for Hatch-managed virtual environments
May 6, 2026
Coverage decreased. Please add tests for new code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hatch environments contain a
pyvenv.cfg, so PET previously classified them as plainVenv. Downstream consumers (e.g. vscode-python-environments) then routed them into the wrong manager collection.Changes
pet-hatchcrate implementing theLocatortrait, modeled onpet-uv/pet-virtualenvwrapper.HATCH_DATA_DIR, then platform defaults matchingplatformdirs.user_data_dir("hatch", appauthor=False)+env/virtual(Linux:$XDG_DATA_HOME/hatch/...or~/.local/share/hatch/...; macOS:~/Library/Application Support/hatch/...; Windows:%LOCALAPPDATA%\hatch\...).try_from()claims a prefix as Hatch when it is either:<storage>/<project-hash>/<env-name>), or.hatch/<env-name>/whose grandparent contains ahatch.tomlor a[tool.hatch]/[tool.hatch.*]section inpyproject.toml.pyvenv.cfgpromptforname; setsproject_pathfor the project-local case.find()walks the default storage dir and the configured workspace.hatch/dirs.HatchtoPythonEnvironmentKindandLocatorKind.crates/pet/src/locators.rs): insertHatchimmediately beforeVenvso it claims first.crates/pet/src/jsonrpc.rs): registerLocatorKind::HatchasRefreshStatePersistence::ConfiguredOnly.Notes for reviewers
<project-name>-<hash>directory name, soproject_pathis leftNonethere. It is populated for the project-local.hatch/case..hatch/discovery requires a Hatch marker file in the workspace to avoid false positives on unrelated.hatchdirectories.pet-uvandpet-poetryclaim envs in their managed directories.